package com.koron.sinoprobe.web.ledger.service;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.koron.bean.query.PageQuery;
import com.koron.sinoprobe.web.ledger.bean.entity.SpProjectEquipment;
import com.koron.sinoprobe.web.ledger.bean.vo.SpProjectVO;
import org.koron.ebs.mybatis.SessionFactory;

import java.util.List;

/**
 * 项目设备从表(SpProjectEquipment)表服务接口
 *
 * @author jzp
 * @since 2022-06-07 11:55:59
 */
public interface SpProjectEquipmentService {

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    SpProjectEquipment getById(SessionFactory factory, String id);

    /**
     * 查询所有数据
     *
     * @param spProjectEquipment 查询条件对象
     * @return 列表结果集
     */
    List<SpProjectEquipment> list(SessionFactory factory, SpProjectEquipment spProjectEquipment);

    /**
     * 分页查询
     * @param spProjectEquipment 分页条件
     * @return 对象列表
     */
    default PageInfo<SpProjectEquipment> page(SessionFactory factory, PageQuery pageQuery, SpProjectEquipment spProjectEquipment){
        PageHelper.startPage(pageQuery.getPage(), pageQuery.getPageSize(), pageQuery.getOrderBy());
        List<SpProjectEquipment> spProjectEquipmentList = list(factory, spProjectEquipment);
        return new PageInfo<>(spProjectEquipmentList);
    }

    /**
     * 新增数据
     *
     * @param spProjectEquipment 实例对象
     * @return 是否成功
     */
    boolean save(SessionFactory factory, SpProjectEquipment spProjectEquipment);

    boolean saveOrUpdateBatch(SessionFactory factory, SpProjectVO spProjectVO);

    /**
     * 修改数据
     *
     * @param spProjectEquipment 实例对象
     * @return 是否成功
     */
    boolean update(SessionFactory factory, SpProjectEquipment spProjectEquipment);

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    boolean deleteById(SessionFactory factory, String id);

    boolean deleteBatchIds(SessionFactory factory, List<String> ids);

    boolean removeByProjectId(SessionFactory factory, String projectId);

}
